<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>凯盛项目管理系统</title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />

  </head>
  
  <body>
    <%@ include file="top.jsp"  %>
    <div class="container" style="margin-top:60px">
		<div class="row">
			<div class="span3">
				<div class="well" style="padding:10px 0;margin-top:20px;">
					<ul class="nav nav-list">
					  <li class="nav-header">${sessionScope.pu.project.name }</li>
					  <li >${sessionScope.user.username }:${sessionScope.pu.role }</li>
					  <li class="divider"></li>
					  <li ><a href="project.jspx?id=${sessionScope.pu.projectid }"><i class=" icon-home"></i>最新动态</a></li>
					  <li class="active"><a href="goal.jspx"><i class="icon-flag icon-white"></i>目标</a></li>
					  <li><a href="document.jspx"><i class="icon-folder-open"></i>资料库</a></li>
					  <li><a href="file.jspx"><i class="icon-file"></i>文件共享</a></li>
					  <li><a href="contact.jspx"><i class="icon-user"></i>联系人</a></li>
					  <li><a href="idea.jspx"><i class="icon-fire"></i>想法</a></li>
					  <li><a href="#"><i class="icon-warning-sign"></i>Bug</a></li>
					  <li><a href="main.jspx?m=editProject&id=${pu.projectid }"><i class="icon-cog"></i>项目设置</a></li>
					</ul>
				</div>
			</div>
			
			<div class="span9">
				<ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;margin-top:20px;height:25px">
					<li class="active" style="padding-top:6px">
						<i class="icon-th"></i><a href="#" style="font-size:16px;">${goal.name}</a> 					
					</li>		
					<li class="active" style="margin-top:6px;float:right;">
						<i class="icon-edit" ></i><a href="goal.jspx?m=edit&id=${goal.id}" style="font-size:16px;">编辑</a> 					
					</li>
				</ul>
				<div class="well" style="border-radius:0px;border-top:none;">
					<c:set var="rate">0</c:set>
					
					<c:forEach items="${requestScope.tasklist}" var="t">
						<c:set var="rate" value="${pageScope.rate + t.rate}"/>
					</c:forEach>
					
					<p>${goal.cont }</p>					
					<div class="progress progress-striped active">
					  <div class="bar" style="width: ${(pageScope.rate)/(fn:length(tasklist))}%;">已完成${(pageScope.rate/fn:length(tasklist))}%</div>
					</div>
					<div class="page-header">
						<a href="task.jspx?m=addTask&id=${goal.id }" class="btn btn-success">
							<i class="icon-plus icon-white"></i>添加新任务
						</a>
					</div>
					<c:forEach items="${requestScope.tasklist}" var="t">
						<div>
							<i class="icon-bookmark"></i>
							<a href="task.jspx?m=editTask&id=${t.id}" style="color:#000;font-size:16px">${t.name}</a>&nbsp;&nbsp;&nbsp;[${t.user.username }]
						</div>
						<dd style="font-size:14px">${t.cont}</dd>
						<!-- 进度条的不同显示的判断-->
						<c:choose>
							<c:when test="${t.rate == 0}"></c:when>
							<c:when test="${t.rate < 35 }">
								<div class="progress progress-danger progress-striped active">
									<div class="bar" style="width:${t.rate}%;">已完成${t.rate}%</div>
								</div>
							</c:when>
							<c:when test="${t.rate < 70 }">
								<div class="progress progress-warning progress-striped active">
									<div class="bar" style="width:${t.rate}%;">已完成${t.rate}%</div>
								</div>
							</c:when>
							<c:when test="${t.rate < 100 }">
								<div class="progress progress-striped active">
									<div class="bar" style="width:${t.rate}%;">已完成${t.rate}%</div>
								</div>
							</c:when>
							<c:when test="${t.rate == 100 }">
								<div class="progress progress-success progress-striped active">
									<div class="bar" style="width:${t.rate}%;">全部完成</div>
								</div>
							</c:when>
						</c:choose>
						
						<div style="font-size:12px">
							任务时间：${t.begintime} &nbsp;&nbsp;———— &nbsp;&nbsp;${t.deadtime}
						</div>
						<hr/>
					</c:forEach>				
				</div>
			</div>	
			
		</div>
	</div>
  </body>
</html>
